package com.tinyideatech.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tinyideatech.system.entity.SysRoleMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {

    @Select("select perms from sys_menu where perms is not null and perms <> '' and menu_id in " +
            "(select menu_id from sys_role_menu where role_id in (select role_id from sys_user_role where user_id = #{userId}))")
    Set<String> selectRoleKeysByUserId(@Param("userId") Long userId);

}
